<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    // 1 中文正则

    var nickName = /^[\u4e00 - \u9fa5]{3,5}$/

    // 邮箱正则
    var reg2 = /[\w!#$ %& '*+/=?^_`{|}~-]+(?:\.[\w!#$%&' * +/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/

    var str2 = "{sdfasdf|sadf@qq.com"
    console.log(reg2.test(str2))
    // 身份证号  /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/
    var reg3 = /^ [1 - 9]\d{ 5 } ((20\d{2}) | (3\d\d{2}) ) ((0[1 - 9])  | (1[0 - 2]))(([0 - 2][1 - 9]) | 10 | 20 | 30 | 31) \d{ 3 } [0 - 9Xx]$ /;
    var str3 = "232326202001026789"
    console.log(reg3.test(str3))
    // qq号/[1 - 9][0 - 9]{ 4,}/

    // 手机号
    var phoneReg = /^1(3|4|5|6|7|8|9)\d{9}$/

    //邮箱正则    \.  匹配.      . 任意字符
    var email = /\w@[a - z0 - 9]{ 2, 4 }\.[a - z]{ 2, 4 } /;

    // 密码
    var reg18 = /^\w{6,18}$/

  </script>
</body>

</html>